package cn.xi.goods.controller;

import cn.xi.goods.service.SpecService;
import cn.xi.pojo.Spec;
import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/spec")
@CrossOrigin  //开启跨区域请求
public class SpecController {
    @Autowired
    private SpecService specService;

    @GetMapping("/catbrand/{name}")
    public Result<Spec> findSpecByBrand(@PathVariable String name){
        List<Map> specByBrand = specService.findSpecByBrand(name);
        return new Result<>(true, StatusCode.OK,"查询成功",specByBrand);
    }


}
